home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / jed10.zip / EAT3.ASM < prev    next >
Assembly Source File  |  1993-02-26  |  8KB  |  215 lines

  1.  
  2. ;---------------------------------------------------------------
  3. ;                             EAT3.ASM
  4. ;      Backhanded advertising program, over the full screen
  5. ;
  6. ;                                      by Jeff Duntemann
  7. ;                                      MASM/TASM
  8. ;                                      Last update 12/27/89
  9. ;---------------------------------------------------------------
  10.  
  11. ;----------------------------|
  12. ;    BEGIN STACK SEGMENT     |
  13. ;----------------------------|
  14. MYSTACK    SEGMENT STACK        ; STACK word ensures loading of SS by DOS
  15.  
  16.            DB      64 DUP ('STACK!!!') ; This reserves 512 bytes for the stack
  17.  
  18. MYSTACK    ENDS
  19. ;----------------------------|
  20. ;     END STACK SEGMENT      |
  21. ;----------------------------|
  22.  
  23.  
  24. ;----------------------------|
  25. ;     BEGIN DATA SEGMENT     |
  26. ;----------------------------|
  27. MyData     SEGMENT
  28.  
  29. ; 18H = 24D; 4FH = 79D; Combined 0-based X,Y of 80 x 25 screen LR corner:
  30. LRXY       DW      184FH
  31.  
  32. TextPos    DW      ?
  33. Eat1       DB      "Eat at Joe's...",'$'
  34. Eat2       DB      "...ten million flies can't ALL be wrong!",'$'
  35. CRLF       DB      0DH,0AH,'$'
  36.  
  37. MyData     ENDS
  38. ;----------------------------|
  39. ;      END DATA SEGMENT      |
  40. ;----------------------------|
  41.  
  42. ;----------------------------|
  43. ;     BEGIN CODE SEGMENT     |
  44. ;----------------------------|
  45. MyProg     SEGMENT
  46.  
  47.            assume CS:MyProg,DS:MyData
  48. Main       PROC
  49.  
  50. Start:     ; This is where program execution begins:
  51.            mov  AX,MyData   ; Set up our own data segment address in DS
  52.            mov  DS,AX       ; Can't load segment reg. directly from memory
  53.  
  54.            call ClrScr      ; Clear the full display
  55.  
  56.            mov  TextPos, 0914H   ; 0914H = X @ 20, Y @ 9
  57.  
  58.            mov  DX,TextPos  ; TextPos contains X,Y position values
  59.            call GotoXY      ; Position cursor
  60.            lea  DX,Eat1     ; Load offset of Eat1 string into DX
  61.            call Write       ;   and display it
  62.  
  63.            mov  DX,TextPos  ; Re-use text position variable
  64.            mov  DH,10       ; Put new Y value into DH
  65.            call GotoXY      ; Position cursor
  66.            lea  DX,Eat2     ; Load offset of Ear2 string into DX
  67.            call Writeln     ;   and display it
  68.  
  69.            mov  AH,4CH      ; Terminate process DOS service
  70.            mov  AL,0        ; Pass this value back to ERRORLEVEL
  71.            int  21H         ; Control returns to DOS
  72.  
  73. ;----------------------------|
  74. ;   PROCEDURE SECTION        |
  75. ;----------------------------|
  76.  
  77. ;---------------------------------------------------------------
  78. ;   GOTOXY    --  Positions the hardware cursor to X,Y
  79. ;   Last update 3/5/89
  80. ;
  81. ;   1 entry point:
  82. ;
  83. ;   GotoXY:
  84. ;      Caller must pass:
  85. ;      DL: X value     These are both 0-based; i.e., they
  86. ;      DH: Y value       assume a screen 24 by 79, not 25 by 80
  87. ;      Action:  Moves the hardware cursor to the X,Y position
  88. ;               loaded into DL and H.
  89. ;---------------------------------------------------------------
  90. GotoXY     PROC
  91.            mov AH,02H        ; Select VIDEO service 2: Position cursor
  92.            mov BH,0          ; Stay with display page 0
  93.            int 10H           ; Call VIDEO
  94.            ret               ; Return to the caller
  95. GotoXY     ENDP
  96.  
  97. ;---------------------------------------------------------------
  98. ;   CLRSCR    --  Clears or scrolls screens or windows
  99. ;   Last update 3/5/89
  100. ;
  101. ;   4 entry points:
  102. ;
  103. ;   ClrScr:
  104. ;      No values expected from caller
  105. ;      Action:  Clears the entire screen to blanks with 07H as
  106. ;               the display attribute
  107. ;
  108. ;   ClrWin:
  109. ;      Caller must pass:
  110. ;      CH: Y coordinate, upper left corner of window
  111. ;      CL: X coordinate, upper left corner of window
  112. ;      DH: Y coordinate, lower right corner of window
  113. ;      DL: X coordinate, lower right corner of window
  114. ;      Action:  Clears the window specified by the caller to
  115. ;               blanks with 07H as the display attribute
  116. ;
  117. ;   ScrlWin:
  118. ;      Caller must pass:
  119. ;      CH: Y coordinate, upper left corner of window
  120. ;      CL: X coordinate, upper left corner of window
  121. ;      DH: Y coordinate, lower right corner of window
  122. ;      DL: X coordinate, lower right corner of window
  123. ;      AL: number of lines to scroll window by (0 clears it)
  124. ;      Action:  Scrolls the window specified by the caller by
  125. ;               the number of lines passed in AL.  The blank
  126. ;               lines inserted at screen bottom are cleared
  127. ;               to blanks with 07H as the display attribute
  128. ;
  129. ;   VIDEO6:
  130. ;      Caller must pass:
  131. ;      CH: Y coordinate, upper left corner of window
  132. ;      CL: X coordinate, upper left corner of window
  133. ;      DH: Y coordinate, lower right corner of window
  134. ;      DL: X coordinate, lower right corner of window
  135. ;      AL: number of lines to scroll window by (0 clears it)
  136. ;      BH: display attribute for blanked lines (07H is "normal")
  137. ;      Action:  Generic access to BIOS VIDEO service 6.  Caller
  138. ;               must pass ALL register parameters as shown above
  139. ;---------------------------------------------------------------
  140.  
  141. ClrScr     PROC
  142.            mov CX,0          ; Upper left corner of full screen
  143.            mov DX,LRXY       ; Load lower-right XY coordinates into DX
  144. ClrWin:    mov AL,0          ; 0 specifies clear entire region
  145. ScrlWin:   mov BH,07H        ; Specify "normal" attribute for blanked line(s)
  146. VIDEO6:    mov AH,06H        ; Select VIDEO service 6: Initialize/Scroll
  147.            int 10H           ; Call VIDEO
  148.            ret               ; Return to the caller
  149. ClrScr     ENDP
  150.  
  151.  
  152. ;---------------------------------------------------------------
  153. ;   WRITE    --  Displays information to the screen via DOS
  154. ;                service 9: Print String
  155. ;   Last update 3/5/89
  156. ;
  157. ;   1 entry point:
  158. ;
  159. ;   Write:
  160. ;      Caller must pass:
  161. ;      DS: The segment of the string to be displayed
  162. ;      DX: The offset of the string to be displayed
  163. ;          String must be terminated by "$"
  164. ;      Action:  Displays the string at DS:DX up to the "$" marker
  165. ;---------------------------------------------------------------
  166.  
  167. Write      PROC
  168.            mov AH,09H        ; Select DOS service 9: Print String
  169.            int 21H           ; Call DOS
  170.            ret               ; Return to the caller
  171. Write      ENDP
  172.  
  173.  
  174. ;---------------------------------------------------------------
  175. ;   WRITELN  --  Displays information to the screen via DOS
  176. ;                service 9 and issues a newline
  177. ;   Last update 3/5/89
  178. ;
  179. ;   1 entry point:
  180. ;
  181. ;   Writeln:
  182. ;      Caller must pass:
  183. ;      DS: The segment of the string to be displayed
  184. ;      DX: The offset of the string to be displayed
  185. ;          String must be terminated by "$"
  186. ;      Action:  Displays the string at DS:DX up to the "$" marker
  187. ;               marker, then issues a newline.  Hardware cursor
  188. ;               will move to the left margin of the following
  189. ;               line.  If the display is to the bottom screen
  190. ;               line, the screen will scroll.
  191. ;      Calls: Write
  192. ;---------------------------------------------------------------
  193.  
  194. Writeln    PROC
  195.            call Write           ; Display the string proper through Write
  196.            mov DX,OFFSET CRLF   ; Load address of newline string to DS:DX
  197.            call Write           ; Display the newline string through Write
  198.            ret                  ; Return to the caller
  199. Writeln    ENDP
  200.  
  201. ;----------------------------|
  202. ;   END PROCEDURE SECTION    |
  203. ;----------------------------|
  204.  
  205.  
  206. Main       ENDP
  207.  
  208. MyProg     ENDS
  209.  
  210. ;----------------------------|
  211. ;      END CODE SEGMENT      |
  212. ;----------------------------|
  213.  
  214.            END Start    ; The procedure named Start becomes the main program
  215.